/**
 * ClassName: Java06_object
 * Package: PACKAGE_NAME
 * DESCRIPTION:
 *
 * @Author 程翎钥
 * @Create 2024/3/30 10:47
 * @Version 1.0
 */
public class Java06_object {
    public static void main(String[] args) {
        int[] arr={6,4,5,3,1,2};
        for(int i=0;i<arr.length-1;i++){
            int maxIndex = 0;
            for(int j=0;j<arr.length-1-i;j++){
                if(arr[j]>arr[maxIndex]){
                    maxIndex=i;
                }
            }
            int n1 = arr[arr.length-1-i];
            int n2 = arr[maxIndex];
            arr[maxIndex] = n1;
            arr[arr.length-1-i] = n2;
        }
        for (int i : arr) {
            System.out.print(i + " ");
        }
    }
}
